package ar.edu.utn.frba.disenio.arena;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.layout.HorizontalLayout;
import org.uqbar.arena.layout.VerticalLayout;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.Window;
import org.uqbar.arena.windows.WindowOwner;

@SuppressWarnings("serial")
public class ErrorWindow extends Window<Object>{
    
	private String operacion;
	private String descripcionError;
	
	public ErrorWindow(WindowOwner owner, String op, String desc) 
	{
		super(owner, null);
        this.setTitle("Aterrizar.com");
        this.operacion = op;
        this.descripcionError = desc;
	}

	
    @Override
    public void createContents(Panel mainPanel) 
    {
        Panel panel = new Panel(mainPanel);
        panel.setLayout(new VerticalLayout());
        
        new Label(panel).setText
        ("Se ha producido un error al " + this.operacion + 
         ": <" + this.descripcionError + ">\n" +
         "Por favor intente nuevamente.")
         .setFontSize(11)
         .setHeigth(40);
        
        Panel actionPanel = new Panel(mainPanel);
        actionPanel.setLayout(new HorizontalLayout());
        
        new Button(actionPanel)
        .setCaption("Aceptar")
        .onClick(new MessageSend(this,"close"));
    }
    

}

